TTY Stdin Writer PRO
Represents a writable input stream for a TTY (teletypewriter) session opened over SSH. This class allows writing text to the remote terminal’s standard input and resizing the terminal window dynamically.
This class is typically returned from methods such as SSHClient.withPTY() and SSHClient.withTTY().
Methods
write(data: string): Promise<void>
Writes the given string to the standard input of the TTY session.
Parameters:
data(string): The string data to send to the remote terminal’sstdin. This can include control characters (e.g.,"\r"for Enter,"\x03"for Ctrl+C).
Returns:
- A
Promisethat resolves when the data has been successfully written to the TTY stream.
Example:
changeSize(options: { cols: number; rows: number; pixelWidth: number; pixelHeight: number }): Promise<void>
Resizes the remote terminal window. This is useful for applications that rely on terminal dimensions, such as text editors or full-screen tools (e.g., vim, htop).
Parameters:
-
options(object): An object describing the new terminal dimensions:-
cols(number): The number of character columns in the terminal (e.g., 80). -
rows(number): The number of character rows in the terminal (e.g., 24). -
pixelWidth(number): The pixel width of the terminal window. Use0if not applicable. -
pixelHeight(number): The pixel height of the terminal window. Use0if not applicable.
-
Returns:
- A
Promisethat resolves once the terminal size has been successfully updated.
